import server from './myAxios/interceptors';
//商品分类数据列表
export const getCategories=(data)=>{
    return server.request({
        url:'categories',
        method:'get',
    })
}
//参数列表
export const getCategoriesAttributes=(data)=>{
    return server.request({
        url:`categories/${data.id}/attributes`,
        method:'get',
        params:{sel: data.sel}
    })
}
//编辑提交参数
export const putCategories=(data)=>{
    return server.request({
        url:`categories/${data.id}/attributes/${data.attrId}`,
        method:'put',
        data:{
            attr_name:data.attr_name,
            attr_sel:data.attr_sel,
            attr_vals:data.attr_vals||''
        }
    })
}
//删除参数
export const deleteCategories=(data)=>{
    return server.request({
        url:`categories/${data.id}/attributes/${data.attrId}`,
        method:'delete',
    })
}
//添加动态参数或者静态属性
export const postCategories=(data)=>{
    return server.request({
        url:`categories/${data.id}/attributes`,
        method:'post',
        data
    })
}
//添加分类
export const postAddCategories=(data)=>{
    return server.request({
        url:`categories`,
        method:'post',
        data
    })
}